package com.fone.player.activity.local.adapter;

import java.util.ArrayList;
import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

public class LocalMediaPagerAdapter extends FragmentStatePagerAdapter {

	private List<Fragment> Fragments;

	private List<String> mPagerTitles;
	public LocalMediaPagerAdapter(FragmentManager fm, List<Fragment> Fragments) {
		super(fm);
		this.Fragments = Fragments;
		mPagerTitles=new ArrayList<String>();
		mPagerTitles.add("按文件名");
		mPagerTitles.add("按添加时间");
		mPagerTitles.add("私人");
		mPagerTitles.add("文件夹");
	}

	@Override
	public float getPageWidth(int position) {
		 return super.getPageWidth(position);
		
	}

	@Override
	public CharSequence getPageTitle(int position) {
		 return mPagerTitles.get(position);
		 
		
	}
	@Override
	public int getCount() {
		return Fragments.size();
	}


	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		return super.instantiateItem(container, position);
	}

	@Override
	public Fragment getItem(int position) {
		return getFragment(position);

	}

	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}

	private Fragment getFragment(int position) {
		// ListView
		if (Fragments != null) {
			return Fragments.get(position);
		} else {
			return null;
		}
	}

}
